package cn.xej.easyexcel.controller;

import cn.xej.easyexcel.common.RespObj;
import cn.xej.easyexcel.service.ExportService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author <a href="mailto:enjie.xu@yunhutech.com">xiaoming</a>
 * @since 2021/6/7
 */
@RestController
@RequestMapping("/excel")
public class ExcelController {

    @Resource
    private ExportService exportService;

    /**
     * 导出excel
     * @param exportBean
     * @return
     */
    @PostMapping("/export")
    public RespObj export(String exportBean){
        exportService.exportExcel(exportBean);
        return RespObj.build(200,"成功",null);
    }


    @GetMapping("/hello")
    public String hello(){
        System.out.println("ssss");
        return "ss";
    }
}
